// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyavtDatabaseMetaData.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>
#include <PyExpressionList.h>
#include <PyavtMeshMetaData.h>
#include <PyavtSubsetsMetaData.h>
#include <PyavtScalarMetaData.h>
#include <PyavtVectorMetaData.h>
#include <PyavtTensorMetaData.h>
#include <PyavtSymmetricTensorMetaData.h>
#include <PyavtArrayMetaData.h>
#include <PyavtMaterialMetaData.h>
#include <PyavtSpeciesMetaData.h>
#include <PyavtCurveMetaData.h>
#include <PyavtLabelMetaData.h>
#include <PyavtDefaultPlotMetaData.h>
#include <PyavtSimulationInformation.h>

// ****************************************************************************
// Module: PyavtDatabaseMetaData
//
// Purpose:
//   Contains database metadata attributes
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a avtDatabaseMetaData.
//
struct avtDatabaseMetaDataObject
{
    PyObject_HEAD
    avtDatabaseMetaData *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewavtDatabaseMetaData(int);
std::string
PyavtDatabaseMetaData_ToString(const avtDatabaseMetaData *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    if(atts->GetHasTemporalExtents())
        snprintf(tmpStr, 1000, "%shasTemporalExtents = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%shasTemporalExtents = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sminTemporalExtents = %g\n", prefix, atts->GetMinTemporalExtents());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%smaxTemporalExtents = %g\n", prefix, atts->GetMaxTemporalExtents());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%snumStates = %d\n", prefix, atts->GetNumStates());
    str += tmpStr;
    if(atts->GetIsVirtualDatabase())
        snprintf(tmpStr, 1000, "%sisVirtualDatabase = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sisVirtualDatabase = 0\n", prefix);
    str += tmpStr;
    if(atts->GetMustRepopulateOnStateChange())
        snprintf(tmpStr, 1000, "%smustRepopulateOnStateChange = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%smustRepopulateOnStateChange = 0\n", prefix);
    str += tmpStr;
    if(atts->GetMustAlphabetizeVariables())
        snprintf(tmpStr, 1000, "%smustAlphabetizeVariables = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%smustAlphabetizeVariables = 0\n", prefix);
    str += tmpStr;
    if(atts->GetFormatCanDoDomainDecomposition())
        snprintf(tmpStr, 1000, "%sformatCanDoDomainDecomposition = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sformatCanDoDomainDecomposition = 0\n", prefix);
    str += tmpStr;
    if(atts->GetFormatCanDoMultires())
        snprintf(tmpStr, 1000, "%sformatCanDoMultires = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sformatCanDoMultires = 0\n", prefix);
    str += tmpStr;
    if(atts->GetUseCatchAllMesh())
        snprintf(tmpStr, 1000, "%suseCatchAllMesh = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%suseCatchAllMesh = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%stimeStepPath = \"%s\"\n", prefix, atts->GetTimeStepPath().c_str());
    str += tmpStr;
    {   const stringVector &timeStepNames = atts->GetTimeStepNames();
        snprintf(tmpStr, 1000, "%stimeStepNames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < timeStepNames.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", timeStepNames[i].c_str());
            str += tmpStr;
            if(i < timeStepNames.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &cycles = atts->GetCycles();
        snprintf(tmpStr, 1000, "%scycles = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < cycles.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%d", cycles[i]);
            str += tmpStr;
            if(i < cycles.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &cyclesAreAccurate = atts->GetCyclesAreAccurate();
        snprintf(tmpStr, 1000, "%scyclesAreAccurate = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < cyclesAreAccurate.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%d", cyclesAreAccurate[i]);
            str += tmpStr;
            if(i < cyclesAreAccurate.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &times = atts->GetTimes();
        snprintf(tmpStr, 1000, "%stimes = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < times.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", times[i]);
            str += tmpStr;
            if(i < times.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &timesAreAccurate = atts->GetTimesAreAccurate();
        snprintf(tmpStr, 1000, "%stimesAreAccurate = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < timesAreAccurate.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%d", timesAreAccurate[i]);
            str += tmpStr;
            if(i < timesAreAccurate.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    snprintf(tmpStr, 1000, "%sdatabaseName = \"%s\"\n", prefix, atts->GetDatabaseName().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sfileFormat = \"%s\"\n", prefix, atts->GetFileFormat().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sdatabaseComment = \"%s\"\n", prefix, atts->GetDatabaseComment().c_str());
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "exprList.";
        str += PyExpressionList_ToString(&atts->GetExprList(), objPrefix.c_str(), forLogging);
    }
    { // new scope
        int index = 0;
        // Create string representation of meshes from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetMeshes().begin(); pos != atts->GetMeshes().end(); ++pos, ++index)
        {
            const avtMeshMetaData *current = (const avtMeshMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetMeshes(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtMeshMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#meshes does not contain any avtMeshMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of subsets from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetSubsets().begin(); pos != atts->GetSubsets().end(); ++pos, ++index)
        {
            const avtSubsetsMetaData *current = (const avtSubsetsMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetSubsets(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtSubsetsMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#subsets does not contain any avtSubsetsMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of scalars from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetScalars().begin(); pos != atts->GetScalars().end(); ++pos, ++index)
        {
            const avtScalarMetaData *current = (const avtScalarMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetScalars(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtScalarMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#scalars does not contain any avtScalarMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of vectors from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetVectors().begin(); pos != atts->GetVectors().end(); ++pos, ++index)
        {
            const avtVectorMetaData *current = (const avtVectorMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetVectors(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtVectorMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#vectors does not contain any avtVectorMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of tensors from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetTensors().begin(); pos != atts->GetTensors().end(); ++pos, ++index)
        {
            const avtTensorMetaData *current = (const avtTensorMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetTensors(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtTensorMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#tensors does not contain any avtTensorMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of symmTensors from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetSymmTensors().begin(); pos != atts->GetSymmTensors().end(); ++pos, ++index)
        {
            const avtSymmetricTensorMetaData *current = (const avtSymmetricTensorMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetSymmTensors(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtSymmetricTensorMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#symmTensors does not contain any avtSymmetricTensorMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of arrays from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetArrays().begin(); pos != atts->GetArrays().end(); ++pos, ++index)
        {
            const avtArrayMetaData *current = (const avtArrayMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetArrays(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtArrayMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#arrays does not contain any avtArrayMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of materials from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetMaterials().begin(); pos != atts->GetMaterials().end(); ++pos, ++index)
        {
            const avtMaterialMetaData *current = (const avtMaterialMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetMaterials(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtMaterialMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#materials does not contain any avtMaterialMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of species from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetSpecies().begin(); pos != atts->GetSpecies().end(); ++pos, ++index)
        {
            const avtSpeciesMetaData *current = (const avtSpeciesMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetSpecies(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtSpeciesMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#species does not contain any avtSpeciesMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of curves from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetCurves().begin(); pos != atts->GetCurves().end(); ++pos, ++index)
        {
            const avtCurveMetaData *current = (const avtCurveMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetCurves(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtCurveMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#curves does not contain any avtCurveMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of labels from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetLabels().begin(); pos != atts->GetLabels().end(); ++pos, ++index)
        {
            const avtLabelMetaData *current = (const avtLabelMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetLabels(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtLabelMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#labels does not contain any avtLabelMetaData objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of defaultPlots from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetDefaultPlots().begin(); pos != atts->GetDefaultPlots().end(); ++pos, ++index)
        {
            const avtDefaultPlotMetaData *current = (const avtDefaultPlotMetaData *)(*pos);
            snprintf(tmpStr, 1000, "GetDefaultPlots(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyavtDefaultPlotMetaData_ToString(current, objPrefix.c_str(), forLogging);
        }
        if(index == 0)
            str += "#defaultPlots does not contain any avtDefaultPlotMetaData objects.\n";
    }
    if(atts->GetIsSimulation())
        snprintf(tmpStr, 1000, "%sisSimulation = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sisSimulation = 0\n", prefix);
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "simInfo.";
        str += PyavtSimulationInformation_ToString(&atts->GetSimInfo(), objPrefix.c_str(), forLogging);
    }
    {   const stringVector &suggestedDefaultSILRestriction = atts->GetSuggestedDefaultSILRestriction();
        snprintf(tmpStr, 1000, "%ssuggestedDefaultSILRestriction = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < suggestedDefaultSILRestriction.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", suggestedDefaultSILRestriction[i].c_str());
            str += tmpStr;
            if(i < suggestedDefaultSILRestriction.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    snprintf(tmpStr, 1000, "%sreplacementMask = %d\n", prefix, atts->GetReplacementMask());
    str += tmpStr;
    return str;
}

static PyObject *
avtDatabaseMetaData_Notify(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetHasTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the hasTemporalExtents in the object.
    obj->data->SetHasTemporalExtents(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetHasTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetHasTemporalExtents()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetMinTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the minTemporalExtents in the object.
    obj->data->SetMinTemporalExtents(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMinTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetMinTemporalExtents());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetMaxTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the maxTemporalExtents in the object.
    obj->data->SetMaxTemporalExtents(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMaxTemporalExtents(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetMaxTemporalExtents());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetNumStates(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the numStates in the object.
    obj->data->SetNumStates(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetNumStates(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetNumStates()));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetIsVirtualDatabase(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the isVirtualDatabase in the object.
    obj->data->SetIsVirtualDatabase(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetIsVirtualDatabase(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetIsVirtualDatabase()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetMustRepopulateOnStateChange(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the mustRepopulateOnStateChange in the object.
    obj->data->SetMustRepopulateOnStateChange(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMustRepopulateOnStateChange(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetMustRepopulateOnStateChange()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetMustAlphabetizeVariables(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the mustAlphabetizeVariables in the object.
    obj->data->SetMustAlphabetizeVariables(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMustAlphabetizeVariables(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetMustAlphabetizeVariables()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetFormatCanDoDomainDecomposition(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the formatCanDoDomainDecomposition in the object.
    obj->data->SetFormatCanDoDomainDecomposition(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetFormatCanDoDomainDecomposition(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetFormatCanDoDomainDecomposition()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetFormatCanDoMultires(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the formatCanDoMultires in the object.
    obj->data->SetFormatCanDoMultires(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetFormatCanDoMultires(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetFormatCanDoMultires()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetUseCatchAllMesh(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the useCatchAllMesh in the object.
    obj->data->SetUseCatchAllMesh(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetUseCatchAllMesh(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetUseCatchAllMesh()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetTimeStepPath(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the timeStepPath in the object.
    obj->data->SetTimeStepPath(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetTimeStepPath(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetTimeStepPath().c_str());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetTimeStepNames(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetTimeStepNames() = vec;
    // Mark the timeStepNames in the object as modified.
    obj->data->SelectTimeStepNames();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetTimeStepNames(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the timeStepNames.
    const stringVector &timeStepNames = obj->data->GetTimeStepNames();
    PyObject *retval = PyTuple_New(timeStepNames.size());
    for(size_t i = 0; i < timeStepNames.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(timeStepNames[i].c_str()));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetCycles(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    intVector vec;

    if (PyNumber_Check(args))
    {
        long val = PyLong_AsLong(args);
        int cval = int(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ int");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ int");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            long val = PyLong_AsLong(item);
            int cval = int(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ int", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ int", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more ints");

    obj->data->GetCycles() = vec;
    // Mark the cycles in the object as modified.
    obj->data->SelectCycles();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetCycles(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the cycles.
    const intVector &cycles = obj->data->GetCycles();
    PyObject *retval = PyTuple_New(cycles.size());
    for(size_t i = 0; i < cycles.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyInt_FromLong(long(cycles[i])));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetCyclesAreAccurate(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    intVector vec;

    if (PyNumber_Check(args))
    {
        long val = PyLong_AsLong(args);
        int cval = int(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ int");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ int");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            long val = PyLong_AsLong(item);
            int cval = int(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ int", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ int", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more ints");

    obj->data->GetCyclesAreAccurate() = vec;
    // Mark the cyclesAreAccurate in the object as modified.
    obj->data->SelectCyclesAreAccurate();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetCyclesAreAccurate(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the cyclesAreAccurate.
    const intVector &cyclesAreAccurate = obj->data->GetCyclesAreAccurate();
    PyObject *retval = PyTuple_New(cyclesAreAccurate.size());
    for(size_t i = 0; i < cyclesAreAccurate.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyInt_FromLong(long(cyclesAreAccurate[i])));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetTimes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetTimes() = vec;
    // Mark the times in the object as modified.
    obj->data->SelectTimes();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetTimes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the times.
    const doubleVector &times = obj->data->GetTimes();
    PyObject *retval = PyTuple_New(times.size());
    for(size_t i = 0; i < times.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(times[i]));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetTimesAreAccurate(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    intVector vec;

    if (PyNumber_Check(args))
    {
        long val = PyLong_AsLong(args);
        int cval = int(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ int");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ int");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            long val = PyLong_AsLong(item);
            int cval = int(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ int", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ int", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more ints");

    obj->data->GetTimesAreAccurate() = vec;
    // Mark the timesAreAccurate in the object as modified.
    obj->data->SelectTimesAreAccurate();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetTimesAreAccurate(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the timesAreAccurate.
    const intVector &timesAreAccurate = obj->data->GetTimesAreAccurate();
    PyObject *retval = PyTuple_New(timesAreAccurate.size());
    for(size_t i = 0; i < timesAreAccurate.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyInt_FromLong(long(timesAreAccurate[i])));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetDatabaseName(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the databaseName in the object.
    obj->data->SetDatabaseName(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetDatabaseName(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetDatabaseName().c_str());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetFileFormat(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the fileFormat in the object.
    obj->data->SetFileFormat(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetFileFormat(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetFileFormat().c_str());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetDatabaseComment(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the databaseComment in the object.
    obj->data->SetDatabaseComment(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetDatabaseComment(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetDatabaseComment().c_str());
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetExprList(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *newValue = NULL;
    if(!PyArg_ParseTuple(args, "O", &newValue))
        return NULL;
    if(!PyExpressionList_Check(newValue))
        return PyErr_Format(PyExc_TypeError, "Field exprList can be set only with ExpressionList objects");

    obj->data->SetExprList(*PyExpressionList_FromPyObject(newValue));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetExprList(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Since the new object will point to data owned by this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyExpressionList_Wrap(&obj->data->GetExprList());
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyExpressionList_SetParent(retval, self);

    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMeshes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetMeshes(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetMeshes().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtMeshMetaData_Wrap(&obj->data->GetMeshes(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtMeshMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumMeshes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetMeshes().size());
}

PyObject *
avtDatabaseMetaData_AddMeshes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtMeshMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtMeshMetaData");
    avtMeshMetaData *newData = PyavtMeshMetaData_FromPyObject(element);
    obj->data->AddMeshes(*newData);
    obj->data->SelectMeshes();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Meshes(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveMeshes() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetMeshes();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectMeshes();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveMeshes(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumMeshes())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Meshes(self, index);
}

PyObject *
avtDatabaseMetaData_ClearMeshes(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumMeshes();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Meshes(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetSubsets(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetSubsets(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetSubsets().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtSubsetsMetaData_Wrap(&obj->data->GetSubsets(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtSubsetsMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumSubsets(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetSubsets().size());
}

PyObject *
avtDatabaseMetaData_AddSubsets(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtSubsetsMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtSubsetsMetaData");
    avtSubsetsMetaData *newData = PyavtSubsetsMetaData_FromPyObject(element);
    obj->data->AddSubsets(*newData);
    obj->data->SelectSubsets();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Subsets(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveSubsets() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetSubsets();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectSubsets();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveSubsets(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumSubsets())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Subsets(self, index);
}

PyObject *
avtDatabaseMetaData_ClearSubsets(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumSubsets();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Subsets(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetScalars(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetScalars(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetScalars().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtScalarMetaData_Wrap(&obj->data->GetScalars(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtScalarMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumScalars(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetScalars().size());
}

PyObject *
avtDatabaseMetaData_AddScalars(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtScalarMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtScalarMetaData");
    avtScalarMetaData *newData = PyavtScalarMetaData_FromPyObject(element);
    obj->data->AddScalars(*newData);
    obj->data->SelectScalars();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Scalars(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveScalars() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetScalars();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectScalars();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveScalars(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumScalars())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Scalars(self, index);
}

PyObject *
avtDatabaseMetaData_ClearScalars(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumScalars();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Scalars(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetVectors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetVectors(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetVectors().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtVectorMetaData_Wrap(&obj->data->GetVectors(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtVectorMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumVectors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetVectors().size());
}

PyObject *
avtDatabaseMetaData_AddVectors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtVectorMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtVectorMetaData");
    avtVectorMetaData *newData = PyavtVectorMetaData_FromPyObject(element);
    obj->data->AddVectors(*newData);
    obj->data->SelectVectors();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Vectors(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveVectors() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetVectors();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectVectors();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveVectors(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumVectors())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Vectors(self, index);
}

PyObject *
avtDatabaseMetaData_ClearVectors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumVectors();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Vectors(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetTensors(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetTensors().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtTensorMetaData_Wrap(&obj->data->GetTensors(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtTensorMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetTensors().size());
}

PyObject *
avtDatabaseMetaData_AddTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtTensorMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtTensorMetaData");
    avtTensorMetaData *newData = PyavtTensorMetaData_FromPyObject(element);
    obj->data->AddTensors(*newData);
    obj->data->SelectTensors();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Tensors(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveTensors() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetTensors();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectTensors();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveTensors(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumTensors())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Tensors(self, index);
}

PyObject *
avtDatabaseMetaData_ClearTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumTensors();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Tensors(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetSymmTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetSymmTensors(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetSymmTensors().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtSymmetricTensorMetaData_Wrap(&obj->data->GetSymmTensors(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtSymmetricTensorMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumSymmTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetSymmTensors().size());
}

PyObject *
avtDatabaseMetaData_AddSymmTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtSymmetricTensorMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtSymmetricTensorMetaData");
    avtSymmetricTensorMetaData *newData = PyavtSymmetricTensorMetaData_FromPyObject(element);
    obj->data->AddSymmTensors(*newData);
    obj->data->SelectSymmTensors();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_SymmTensors(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveSymmTensors() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetSymmTensors();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectSymmTensors();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveSymmTensors(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumSymmTensors())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_SymmTensors(self, index);
}

PyObject *
avtDatabaseMetaData_ClearSymmTensors(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumSymmTensors();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_SymmTensors(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetArrays(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetArrays(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetArrays().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtArrayMetaData_Wrap(&obj->data->GetArrays(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtArrayMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumArrays(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetArrays().size());
}

PyObject *
avtDatabaseMetaData_AddArrays(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtArrayMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtArrayMetaData");
    avtArrayMetaData *newData = PyavtArrayMetaData_FromPyObject(element);
    obj->data->AddArrays(*newData);
    obj->data->SelectArrays();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Arrays(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveArrays() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetArrays();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectArrays();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveArrays(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumArrays())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Arrays(self, index);
}

PyObject *
avtDatabaseMetaData_ClearArrays(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumArrays();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Arrays(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetMaterials(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetMaterials(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetMaterials().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtMaterialMetaData_Wrap(&obj->data->GetMaterials(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtMaterialMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumMaterials(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetMaterials().size());
}

PyObject *
avtDatabaseMetaData_AddMaterials(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtMaterialMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtMaterialMetaData");
    avtMaterialMetaData *newData = PyavtMaterialMetaData_FromPyObject(element);
    obj->data->AddMaterials(*newData);
    obj->data->SelectMaterials();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Materials(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveMaterials() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetMaterials();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectMaterials();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveMaterials(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumMaterials())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Materials(self, index);
}

PyObject *
avtDatabaseMetaData_ClearMaterials(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumMaterials();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Materials(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetSpecies(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetSpecies(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetSpecies().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtSpeciesMetaData_Wrap(&obj->data->GetSpecies(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtSpeciesMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumSpecies(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetSpecies().size());
}

PyObject *
avtDatabaseMetaData_AddSpecies(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtSpeciesMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtSpeciesMetaData");
    avtSpeciesMetaData *newData = PyavtSpeciesMetaData_FromPyObject(element);
    obj->data->AddSpecies(*newData);
    obj->data->SelectSpecies();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Species(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveSpecies() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetSpecies();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectSpecies();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveSpecies(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumSpecies())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Species(self, index);
}

PyObject *
avtDatabaseMetaData_ClearSpecies(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumSpecies();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Species(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetCurves(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetCurves(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetCurves().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtCurveMetaData_Wrap(&obj->data->GetCurves(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtCurveMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumCurves(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetCurves().size());
}

PyObject *
avtDatabaseMetaData_AddCurves(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtCurveMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtCurveMetaData");
    avtCurveMetaData *newData = PyavtCurveMetaData_FromPyObject(element);
    obj->data->AddCurves(*newData);
    obj->data->SelectCurves();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Curves(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveCurves() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetCurves();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectCurves();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveCurves(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumCurves())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Curves(self, index);
}

PyObject *
avtDatabaseMetaData_ClearCurves(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumCurves();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Curves(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetLabels(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetLabels(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetLabels().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtLabelMetaData_Wrap(&obj->data->GetLabels(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtLabelMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumLabels(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetLabels().size());
}

PyObject *
avtDatabaseMetaData_AddLabels(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtLabelMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtLabelMetaData");
    avtLabelMetaData *newData = PyavtLabelMetaData_FromPyObject(element);
    obj->data->AddLabels(*newData);
    obj->data->SelectLabels();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_Labels(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveLabels() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetLabels();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectLabels();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveLabels(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumLabels())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_Labels(self, index);
}

PyObject *
avtDatabaseMetaData_ClearLabels(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumLabels();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_Labels(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetDefaultPlots(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int index = -1;
    if (args == NULL)
        return PyErr_Format(PyExc_NameError, "Use .GetDefaultPlots(int index) to get a single entry");
    if (!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "arg must be a single integer index");
    if (index < 0 || (size_t)index >= obj->data->GetDefaultPlots().size())
        return PyErr_Format(PyExc_ValueError, "index out of range");

    // Since the new object will point to data owned by the this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtDefaultPlotMetaData_Wrap(&obj->data->GetDefaultPlots(index));
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtDefaultPlotMetaData_SetParent(retval, self);

    return retval;
}

PyObject *
avtDatabaseMetaData_GetNumDefaultPlots(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    return PyInt_FromLong((long)obj->data->GetDefaultPlots().size());
}

PyObject *
avtDatabaseMetaData_AddDefaultPlots(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *element = NULL;
    if(!PyArg_ParseTuple(args, "O", &element))
        return NULL;
    if(!PyavtDefaultPlotMetaData_Check(element))
        return PyErr_Format(PyExc_TypeError, "expected attr object of type avtDefaultPlotMetaData");
    avtDefaultPlotMetaData *newData = PyavtDefaultPlotMetaData_FromPyObject(element);
    obj->data->AddDefaultPlots(*newData);
    obj->data->SelectDefaultPlots();
    Py_INCREF(Py_None);
    return Py_None;
}

static PyObject *
avtDatabaseMetaData_Remove_One_DefaultPlots(PyObject *self, int index)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Remove in the AttributeGroupVector instead of calling RemoveDefaultPlots() because we don't want to delete the object; just remove it.
    AttributeGroupVector &atts = obj->data->GetDefaultPlots();
    AttributeGroupVector::iterator pos = atts.begin();
    // Iterate through the vector "index" times.
    for(int i = 0; i < index; ++i)
        ++pos;

    // If pos is still a valid iterator, remove that element.
    if(pos != atts.end())
    {
        // NOTE: Leak the object since other Python objects may reference it. Ideally,
        // we would put the object into some type of pool to be cleaned up later but
        // this will do for now.
        //
        // delete *pos;
        atts.erase(pos);
    }

    obj->data->SelectDefaultPlots();
    Py_INCREF(Py_None);
    return Py_None;
}

PyObject *
avtDatabaseMetaData_RemoveDefaultPlots(PyObject *self, PyObject *args)
{
    int index = -1;
    if(!PyArg_ParseTuple(args, "i", &index))
        return PyErr_Format(PyExc_TypeError, "Expecting integer index");
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    if(index < 0 || index >= obj->data->GetNumDefaultPlots())
        return PyErr_Format(PyExc_IndexError, "Index out of range");

    return avtDatabaseMetaData_Remove_One_DefaultPlots(self, index);
}

PyObject *
avtDatabaseMetaData_ClearDefaultPlots(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    int n = obj->data->GetNumDefaultPlots();
    for(int i = 0; i < n; ++i)
    {
        avtDatabaseMetaData_Remove_One_DefaultPlots(self, 0);
        Py_DECREF(Py_None);
    }
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetIsSimulation(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the isSimulation in the object.
    obj->data->SetIsSimulation(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetIsSimulation(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetIsSimulation()?1L:0L);
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetSimInfo(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *newValue = NULL;
    if(!PyArg_ParseTuple(args, "O", &newValue))
        return NULL;
    if(!PyavtSimulationInformation_Check(newValue))
        return PyErr_Format(PyExc_TypeError, "Field simInfo can be set only with avtSimulationInformation objects");

    obj->data->SetSimInfo(*PyavtSimulationInformation_FromPyObject(newValue));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetSimInfo(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Since the new object will point to data owned by this object,
    // we need to increment the reference count.
    Py_INCREF(self);

    PyObject *retval = PyavtSimulationInformation_Wrap(&obj->data->GetSimInfo());
    // Set the object's parent so the reference to the parent can be decref'd
    // when the child goes out of scope.
    PyavtSimulationInformation_SetParent(retval, self);

    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetSuggestedDefaultSILRestriction(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetSuggestedDefaultSILRestriction() = vec;
    // Mark the suggestedDefaultSILRestriction in the object as modified.
    obj->data->SelectSuggestedDefaultSILRestriction();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetSuggestedDefaultSILRestriction(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    // Allocate a tuple the with enough entries to hold the suggestedDefaultSILRestriction.
    const stringVector &suggestedDefaultSILRestriction = obj->data->GetSuggestedDefaultSILRestriction();
    PyObject *retval = PyTuple_New(suggestedDefaultSILRestriction.size());
    for(size_t i = 0; i < suggestedDefaultSILRestriction.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(suggestedDefaultSILRestriction[i].c_str()));
    return retval;
}

/*static*/ PyObject *
avtDatabaseMetaData_SetReplacementMask(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the replacementMask in the object.
    obj->data->SetReplacementMask(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
avtDatabaseMetaData_GetReplacementMask(PyObject *self, PyObject *args)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetReplacementMask()));
    return retval;
}



PyMethodDef PyavtDatabaseMetaData_methods[AVTDATABASEMETADATA_NMETH] = {
    {"Notify", avtDatabaseMetaData_Notify, METH_VARARGS},
    {"SetHasTemporalExtents", avtDatabaseMetaData_SetHasTemporalExtents, METH_VARARGS},
    {"GetHasTemporalExtents", avtDatabaseMetaData_GetHasTemporalExtents, METH_VARARGS},
    {"SetMinTemporalExtents", avtDatabaseMetaData_SetMinTemporalExtents, METH_VARARGS},
    {"GetMinTemporalExtents", avtDatabaseMetaData_GetMinTemporalExtents, METH_VARARGS},
    {"SetMaxTemporalExtents", avtDatabaseMetaData_SetMaxTemporalExtents, METH_VARARGS},
    {"GetMaxTemporalExtents", avtDatabaseMetaData_GetMaxTemporalExtents, METH_VARARGS},
    {"SetNumStates", avtDatabaseMetaData_SetNumStates, METH_VARARGS},
    {"GetNumStates", avtDatabaseMetaData_GetNumStates, METH_VARARGS},
    {"SetIsVirtualDatabase", avtDatabaseMetaData_SetIsVirtualDatabase, METH_VARARGS},
    {"GetIsVirtualDatabase", avtDatabaseMetaData_GetIsVirtualDatabase, METH_VARARGS},
    {"SetMustRepopulateOnStateChange", avtDatabaseMetaData_SetMustRepopulateOnStateChange, METH_VARARGS},
    {"GetMustRepopulateOnStateChange", avtDatabaseMetaData_GetMustRepopulateOnStateChange, METH_VARARGS},
    {"SetMustAlphabetizeVariables", avtDatabaseMetaData_SetMustAlphabetizeVariables, METH_VARARGS},
    {"GetMustAlphabetizeVariables", avtDatabaseMetaData_GetMustAlphabetizeVariables, METH_VARARGS},
    {"SetFormatCanDoDomainDecomposition", avtDatabaseMetaData_SetFormatCanDoDomainDecomposition, METH_VARARGS},
    {"GetFormatCanDoDomainDecomposition", avtDatabaseMetaData_GetFormatCanDoDomainDecomposition, METH_VARARGS},
    {"SetFormatCanDoMultires", avtDatabaseMetaData_SetFormatCanDoMultires, METH_VARARGS},
    {"GetFormatCanDoMultires", avtDatabaseMetaData_GetFormatCanDoMultires, METH_VARARGS},
    {"SetUseCatchAllMesh", avtDatabaseMetaData_SetUseCatchAllMesh, METH_VARARGS},
    {"GetUseCatchAllMesh", avtDatabaseMetaData_GetUseCatchAllMesh, METH_VARARGS},
    {"SetTimeStepPath", avtDatabaseMetaData_SetTimeStepPath, METH_VARARGS},
    {"GetTimeStepPath", avtDatabaseMetaData_GetTimeStepPath, METH_VARARGS},
    {"SetTimeStepNames", avtDatabaseMetaData_SetTimeStepNames, METH_VARARGS},
    {"GetTimeStepNames", avtDatabaseMetaData_GetTimeStepNames, METH_VARARGS},
    {"SetCycles", avtDatabaseMetaData_SetCycles, METH_VARARGS},
    {"GetCycles", avtDatabaseMetaData_GetCycles, METH_VARARGS},
    {"SetCyclesAreAccurate", avtDatabaseMetaData_SetCyclesAreAccurate, METH_VARARGS},
    {"GetCyclesAreAccurate", avtDatabaseMetaData_GetCyclesAreAccurate, METH_VARARGS},
    {"SetTimes", avtDatabaseMetaData_SetTimes, METH_VARARGS},
    {"GetTimes", avtDatabaseMetaData_GetTimes, METH_VARARGS},
    {"SetTimesAreAccurate", avtDatabaseMetaData_SetTimesAreAccurate, METH_VARARGS},
    {"GetTimesAreAccurate", avtDatabaseMetaData_GetTimesAreAccurate, METH_VARARGS},
    {"SetDatabaseName", avtDatabaseMetaData_SetDatabaseName, METH_VARARGS},
    {"GetDatabaseName", avtDatabaseMetaData_GetDatabaseName, METH_VARARGS},
    {"SetFileFormat", avtDatabaseMetaData_SetFileFormat, METH_VARARGS},
    {"GetFileFormat", avtDatabaseMetaData_GetFileFormat, METH_VARARGS},
    {"SetDatabaseComment", avtDatabaseMetaData_SetDatabaseComment, METH_VARARGS},
    {"GetDatabaseComment", avtDatabaseMetaData_GetDatabaseComment, METH_VARARGS},
    {"SetExprList", avtDatabaseMetaData_SetExprList, METH_VARARGS},
    {"GetExprList", avtDatabaseMetaData_GetExprList, METH_VARARGS},
    {"GetMeshes", avtDatabaseMetaData_GetMeshes, METH_VARARGS},
    {"GetNumMeshes", avtDatabaseMetaData_GetNumMeshes, METH_VARARGS},
    {"AddMeshes", avtDatabaseMetaData_AddMeshes, METH_VARARGS},
    {"RemoveMeshes", avtDatabaseMetaData_RemoveMeshes, METH_VARARGS},
    {"ClearMeshes", avtDatabaseMetaData_ClearMeshes, METH_VARARGS},
    {"GetSubsets", avtDatabaseMetaData_GetSubsets, METH_VARARGS},
    {"GetNumSubsets", avtDatabaseMetaData_GetNumSubsets, METH_VARARGS},
    {"AddSubsets", avtDatabaseMetaData_AddSubsets, METH_VARARGS},
    {"RemoveSubsets", avtDatabaseMetaData_RemoveSubsets, METH_VARARGS},
    {"ClearSubsets", avtDatabaseMetaData_ClearSubsets, METH_VARARGS},
    {"GetScalars", avtDatabaseMetaData_GetScalars, METH_VARARGS},
    {"GetNumScalars", avtDatabaseMetaData_GetNumScalars, METH_VARARGS},
    {"AddScalars", avtDatabaseMetaData_AddScalars, METH_VARARGS},
    {"RemoveScalars", avtDatabaseMetaData_RemoveScalars, METH_VARARGS},
    {"ClearScalars", avtDatabaseMetaData_ClearScalars, METH_VARARGS},
    {"GetVectors", avtDatabaseMetaData_GetVectors, METH_VARARGS},
    {"GetNumVectors", avtDatabaseMetaData_GetNumVectors, METH_VARARGS},
    {"AddVectors", avtDatabaseMetaData_AddVectors, METH_VARARGS},
    {"RemoveVectors", avtDatabaseMetaData_RemoveVectors, METH_VARARGS},
    {"ClearVectors", avtDatabaseMetaData_ClearVectors, METH_VARARGS},
    {"GetTensors", avtDatabaseMetaData_GetTensors, METH_VARARGS},
    {"GetNumTensors", avtDatabaseMetaData_GetNumTensors, METH_VARARGS},
    {"AddTensors", avtDatabaseMetaData_AddTensors, METH_VARARGS},
    {"RemoveTensors", avtDatabaseMetaData_RemoveTensors, METH_VARARGS},
    {"ClearTensors", avtDatabaseMetaData_ClearTensors, METH_VARARGS},
    {"GetSymmTensors", avtDatabaseMetaData_GetSymmTensors, METH_VARARGS},
    {"GetNumSymmTensors", avtDatabaseMetaData_GetNumSymmTensors, METH_VARARGS},
    {"AddSymmTensors", avtDatabaseMetaData_AddSymmTensors, METH_VARARGS},
    {"RemoveSymmTensors", avtDatabaseMetaData_RemoveSymmTensors, METH_VARARGS},
    {"ClearSymmTensors", avtDatabaseMetaData_ClearSymmTensors, METH_VARARGS},
    {"GetArrays", avtDatabaseMetaData_GetArrays, METH_VARARGS},
    {"GetNumArrays", avtDatabaseMetaData_GetNumArrays, METH_VARARGS},
    {"AddArrays", avtDatabaseMetaData_AddArrays, METH_VARARGS},
    {"RemoveArrays", avtDatabaseMetaData_RemoveArrays, METH_VARARGS},
    {"ClearArrays", avtDatabaseMetaData_ClearArrays, METH_VARARGS},
    {"GetMaterials", avtDatabaseMetaData_GetMaterials, METH_VARARGS},
    {"GetNumMaterials", avtDatabaseMetaData_GetNumMaterials, METH_VARARGS},
    {"AddMaterials", avtDatabaseMetaData_AddMaterials, METH_VARARGS},
    {"RemoveMaterials", avtDatabaseMetaData_RemoveMaterials, METH_VARARGS},
    {"ClearMaterials", avtDatabaseMetaData_ClearMaterials, METH_VARARGS},
    {"GetSpecies", avtDatabaseMetaData_GetSpecies, METH_VARARGS},
    {"GetNumSpecies", avtDatabaseMetaData_GetNumSpecies, METH_VARARGS},
    {"AddSpecies", avtDatabaseMetaData_AddSpecies, METH_VARARGS},
    {"RemoveSpecies", avtDatabaseMetaData_RemoveSpecies, METH_VARARGS},
    {"ClearSpecies", avtDatabaseMetaData_ClearSpecies, METH_VARARGS},
    {"GetCurves", avtDatabaseMetaData_GetCurves, METH_VARARGS},
    {"GetNumCurves", avtDatabaseMetaData_GetNumCurves, METH_VARARGS},
    {"AddCurves", avtDatabaseMetaData_AddCurves, METH_VARARGS},
    {"RemoveCurves", avtDatabaseMetaData_RemoveCurves, METH_VARARGS},
    {"ClearCurves", avtDatabaseMetaData_ClearCurves, METH_VARARGS},
    {"GetLabels", avtDatabaseMetaData_GetLabels, METH_VARARGS},
    {"GetNumLabels", avtDatabaseMetaData_GetNumLabels, METH_VARARGS},
    {"AddLabels", avtDatabaseMetaData_AddLabels, METH_VARARGS},
    {"RemoveLabels", avtDatabaseMetaData_RemoveLabels, METH_VARARGS},
    {"ClearLabels", avtDatabaseMetaData_ClearLabels, METH_VARARGS},
    {"GetDefaultPlots", avtDatabaseMetaData_GetDefaultPlots, METH_VARARGS},
    {"GetNumDefaultPlots", avtDatabaseMetaData_GetNumDefaultPlots, METH_VARARGS},
    {"AddDefaultPlots", avtDatabaseMetaData_AddDefaultPlots, METH_VARARGS},
    {"RemoveDefaultPlots", avtDatabaseMetaData_RemoveDefaultPlots, METH_VARARGS},
    {"ClearDefaultPlots", avtDatabaseMetaData_ClearDefaultPlots, METH_VARARGS},
    {"SetIsSimulation", avtDatabaseMetaData_SetIsSimulation, METH_VARARGS},
    {"GetIsSimulation", avtDatabaseMetaData_GetIsSimulation, METH_VARARGS},
    {"SetSimInfo", avtDatabaseMetaData_SetSimInfo, METH_VARARGS},
    {"GetSimInfo", avtDatabaseMetaData_GetSimInfo, METH_VARARGS},
    {"SetSuggestedDefaultSILRestriction", avtDatabaseMetaData_SetSuggestedDefaultSILRestriction, METH_VARARGS},
    {"GetSuggestedDefaultSILRestriction", avtDatabaseMetaData_GetSuggestedDefaultSILRestriction, METH_VARARGS},
    {"SetReplacementMask", avtDatabaseMetaData_SetReplacementMask, METH_VARARGS},
    {"GetReplacementMask", avtDatabaseMetaData_GetReplacementMask, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
avtDatabaseMetaData_dealloc(PyObject *v)
{
   avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *avtDatabaseMetaData_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyavtDatabaseMetaData_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "hasTemporalExtents") == 0)
        return avtDatabaseMetaData_GetHasTemporalExtents(self, NULL);
    if(strcmp(name, "minTemporalExtents") == 0)
        return avtDatabaseMetaData_GetMinTemporalExtents(self, NULL);
    if(strcmp(name, "maxTemporalExtents") == 0)
        return avtDatabaseMetaData_GetMaxTemporalExtents(self, NULL);
    if(strcmp(name, "numStates") == 0)
        return avtDatabaseMetaData_GetNumStates(self, NULL);
    if(strcmp(name, "isVirtualDatabase") == 0)
        return avtDatabaseMetaData_GetIsVirtualDatabase(self, NULL);
    if(strcmp(name, "mustRepopulateOnStateChange") == 0)
        return avtDatabaseMetaData_GetMustRepopulateOnStateChange(self, NULL);
    if(strcmp(name, "mustAlphabetizeVariables") == 0)
        return avtDatabaseMetaData_GetMustAlphabetizeVariables(self, NULL);
    if(strcmp(name, "formatCanDoDomainDecomposition") == 0)
        return avtDatabaseMetaData_GetFormatCanDoDomainDecomposition(self, NULL);
    if(strcmp(name, "formatCanDoMultires") == 0)
        return avtDatabaseMetaData_GetFormatCanDoMultires(self, NULL);
    if(strcmp(name, "useCatchAllMesh") == 0)
        return avtDatabaseMetaData_GetUseCatchAllMesh(self, NULL);
    if(strcmp(name, "timeStepPath") == 0)
        return avtDatabaseMetaData_GetTimeStepPath(self, NULL);
    if(strcmp(name, "timeStepNames") == 0)
        return avtDatabaseMetaData_GetTimeStepNames(self, NULL);
    if(strcmp(name, "cycles") == 0)
        return avtDatabaseMetaData_GetCycles(self, NULL);
    if(strcmp(name, "cyclesAreAccurate") == 0)
        return avtDatabaseMetaData_GetCyclesAreAccurate(self, NULL);
    if(strcmp(name, "times") == 0)
        return avtDatabaseMetaData_GetTimes(self, NULL);
    if(strcmp(name, "timesAreAccurate") == 0)
        return avtDatabaseMetaData_GetTimesAreAccurate(self, NULL);
    if(strcmp(name, "databaseName") == 0)
        return avtDatabaseMetaData_GetDatabaseName(self, NULL);
    if(strcmp(name, "fileFormat") == 0)
        return avtDatabaseMetaData_GetFileFormat(self, NULL);
    if(strcmp(name, "databaseComment") == 0)
        return avtDatabaseMetaData_GetDatabaseComment(self, NULL);
    if(strcmp(name, "exprList") == 0)
        return avtDatabaseMetaData_GetExprList(self, NULL);
    if(strcmp(name, "meshes") == 0)
        return avtDatabaseMetaData_GetMeshes(self, NULL);
    if(strcmp(name, "subsets") == 0)
        return avtDatabaseMetaData_GetSubsets(self, NULL);
    if(strcmp(name, "scalars") == 0)
        return avtDatabaseMetaData_GetScalars(self, NULL);
    if(strcmp(name, "vectors") == 0)
        return avtDatabaseMetaData_GetVectors(self, NULL);
    if(strcmp(name, "tensors") == 0)
        return avtDatabaseMetaData_GetTensors(self, NULL);
    if(strcmp(name, "symmTensors") == 0)
        return avtDatabaseMetaData_GetSymmTensors(self, NULL);
    if(strcmp(name, "arrays") == 0)
        return avtDatabaseMetaData_GetArrays(self, NULL);
    if(strcmp(name, "materials") == 0)
        return avtDatabaseMetaData_GetMaterials(self, NULL);
    if(strcmp(name, "species") == 0)
        return avtDatabaseMetaData_GetSpecies(self, NULL);
    if(strcmp(name, "curves") == 0)
        return avtDatabaseMetaData_GetCurves(self, NULL);
    if(strcmp(name, "labels") == 0)
        return avtDatabaseMetaData_GetLabels(self, NULL);
    if(strcmp(name, "defaultPlots") == 0)
        return avtDatabaseMetaData_GetDefaultPlots(self, NULL);
    if(strcmp(name, "isSimulation") == 0)
        return avtDatabaseMetaData_GetIsSimulation(self, NULL);
    if(strcmp(name, "simInfo") == 0)
        return avtDatabaseMetaData_GetSimInfo(self, NULL);
    if(strcmp(name, "suggestedDefaultSILRestriction") == 0)
        return avtDatabaseMetaData_GetSuggestedDefaultSILRestriction(self, NULL);
    if(strcmp(name, "replacementMask") == 0)
        return avtDatabaseMetaData_GetReplacementMask(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyavtDatabaseMetaData_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyavtDatabaseMetaData_methods[i].ml_name),
                PyString_FromString(PyavtDatabaseMetaData_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyavtDatabaseMetaData_methods, self, name);
}

int
PyavtDatabaseMetaData_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "hasTemporalExtents") == 0)
        obj = avtDatabaseMetaData_SetHasTemporalExtents(self, args);
    else if(strcmp(name, "minTemporalExtents") == 0)
        obj = avtDatabaseMetaData_SetMinTemporalExtents(self, args);
    else if(strcmp(name, "maxTemporalExtents") == 0)
        obj = avtDatabaseMetaData_SetMaxTemporalExtents(self, args);
    else if(strcmp(name, "numStates") == 0)
        obj = avtDatabaseMetaData_SetNumStates(self, args);
    else if(strcmp(name, "isVirtualDatabase") == 0)
        obj = avtDatabaseMetaData_SetIsVirtualDatabase(self, args);
    else if(strcmp(name, "mustRepopulateOnStateChange") == 0)
        obj = avtDatabaseMetaData_SetMustRepopulateOnStateChange(self, args);
    else if(strcmp(name, "mustAlphabetizeVariables") == 0)
        obj = avtDatabaseMetaData_SetMustAlphabetizeVariables(self, args);
    else if(strcmp(name, "formatCanDoDomainDecomposition") == 0)
        obj = avtDatabaseMetaData_SetFormatCanDoDomainDecomposition(self, args);
    else if(strcmp(name, "formatCanDoMultires") == 0)
        obj = avtDatabaseMetaData_SetFormatCanDoMultires(self, args);
    else if(strcmp(name, "useCatchAllMesh") == 0)
        obj = avtDatabaseMetaData_SetUseCatchAllMesh(self, args);
    else if(strcmp(name, "timeStepPath") == 0)
        obj = avtDatabaseMetaData_SetTimeStepPath(self, args);
    else if(strcmp(name, "timeStepNames") == 0)
        obj = avtDatabaseMetaData_SetTimeStepNames(self, args);
    else if(strcmp(name, "cycles") == 0)
        obj = avtDatabaseMetaData_SetCycles(self, args);
    else if(strcmp(name, "cyclesAreAccurate") == 0)
        obj = avtDatabaseMetaData_SetCyclesAreAccurate(self, args);
    else if(strcmp(name, "times") == 0)
        obj = avtDatabaseMetaData_SetTimes(self, args);
    else if(strcmp(name, "timesAreAccurate") == 0)
        obj = avtDatabaseMetaData_SetTimesAreAccurate(self, args);
    else if(strcmp(name, "databaseName") == 0)
        obj = avtDatabaseMetaData_SetDatabaseName(self, args);
    else if(strcmp(name, "fileFormat") == 0)
        obj = avtDatabaseMetaData_SetFileFormat(self, args);
    else if(strcmp(name, "databaseComment") == 0)
        obj = avtDatabaseMetaData_SetDatabaseComment(self, args);
    else if(strcmp(name, "exprList") == 0)
        obj = avtDatabaseMetaData_SetExprList(self, args);
    else if(strcmp(name, "isSimulation") == 0)
        obj = avtDatabaseMetaData_SetIsSimulation(self, args);
    else if(strcmp(name, "simInfo") == 0)
        obj = avtDatabaseMetaData_SetSimInfo(self, args);
    else if(strcmp(name, "suggestedDefaultSILRestriction") == 0)
        obj = avtDatabaseMetaData_SetSuggestedDefaultSILRestriction(self, args);
    else if(strcmp(name, "replacementMask") == 0)
        obj = avtDatabaseMetaData_SetReplacementMask(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
avtDatabaseMetaData_print(PyObject *v, FILE *fp, int flags)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)v;
    fprintf(fp, "%s", PyavtDatabaseMetaData_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
avtDatabaseMetaData_str(PyObject *v)
{
    avtDatabaseMetaDataObject *obj = (avtDatabaseMetaDataObject *)v;
    return PyString_FromString(PyavtDatabaseMetaData_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *avtDatabaseMetaData_Purpose = "Contains database metadata attributes";
#else
static char *avtDatabaseMetaData_Purpose = "Contains database metadata attributes";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(avtDatabaseMetaDataType,         \
                  "avtDatabaseMetaData",           \
                  avtDatabaseMetaDataObject,       \
                  avtDatabaseMetaData_dealloc,     \
                  avtDatabaseMetaData_print,       \
                  PyavtDatabaseMetaData_getattr,   \
                  PyavtDatabaseMetaData_setattr,   \
                  avtDatabaseMetaData_str,         \
                  avtDatabaseMetaData_Purpose,     \
                  avtDatabaseMetaData_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
avtDatabaseMetaData_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &avtDatabaseMetaDataType
         || Py_TYPE(other) != &avtDatabaseMetaDataType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    avtDatabaseMetaData *a = ((avtDatabaseMetaDataObject *)self)->data;
    avtDatabaseMetaData *b = ((avtDatabaseMetaDataObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static avtDatabaseMetaData *defaultAtts = 0;
static avtDatabaseMetaData *currentAtts = 0;

static PyObject *
NewavtDatabaseMetaData(int useCurrent)
{
    avtDatabaseMetaDataObject *newObject;
    newObject = PyObject_NEW(avtDatabaseMetaDataObject, &avtDatabaseMetaDataType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new avtDatabaseMetaData(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new avtDatabaseMetaData(*defaultAtts);
    else
        newObject->data = new avtDatabaseMetaData;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapavtDatabaseMetaData(const avtDatabaseMetaData *attr)
{
    avtDatabaseMetaDataObject *newObject;
    newObject = PyObject_NEW(avtDatabaseMetaDataObject, &avtDatabaseMetaDataType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (avtDatabaseMetaData *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
avtDatabaseMetaData_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewavtDatabaseMetaData(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef avtDatabaseMetaDataMethods[] = {
    {"avtDatabaseMetaData", avtDatabaseMetaData_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *avtDatabaseMetaDataObserver = 0;

std::string
PyavtDatabaseMetaData_GetLogString()
{
    std::string s("avtDatabaseMetaData = avtDatabaseMetaData()\n");
    if(currentAtts != 0)
        s += PyavtDatabaseMetaData_ToString(currentAtts, "avtDatabaseMetaData.", true);
    return s;
}

static void
PyavtDatabaseMetaData_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("avtDatabaseMetaData = avtDatabaseMetaData()\n");
        s += PyavtDatabaseMetaData_ToString(currentAtts, "avtDatabaseMetaData.", true);
        cb(s);
    }
}

void
PyavtDatabaseMetaData_StartUp(avtDatabaseMetaData *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyavtDatabaseMetaData_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(avtDatabaseMetaDataObserver == 0)
    {
        avtDatabaseMetaDataObserver = new ObserverToCallback(subj,
            PyavtDatabaseMetaData_CallLogRoutine, (void *)data);
    }

}

void
PyavtDatabaseMetaData_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete avtDatabaseMetaDataObserver;
    avtDatabaseMetaDataObserver = 0;
}

PyMethodDef *
PyavtDatabaseMetaData_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return avtDatabaseMetaDataMethods;
}

bool
PyavtDatabaseMetaData_Check(PyObject *obj)
{
    return (obj->ob_type == &avtDatabaseMetaDataType);
}

avtDatabaseMetaData *
PyavtDatabaseMetaData_FromPyObject(PyObject *obj)
{
    avtDatabaseMetaDataObject *obj2 = (avtDatabaseMetaDataObject *)obj;
    return obj2->data;
}

PyObject *
PyavtDatabaseMetaData_New()
{
    return NewavtDatabaseMetaData(0);
}

PyObject *
PyavtDatabaseMetaData_Wrap(const avtDatabaseMetaData *attr)
{
    return WrapavtDatabaseMetaData(attr);
}

void
PyavtDatabaseMetaData_SetParent(PyObject *obj, PyObject *parent)
{
    avtDatabaseMetaDataObject *obj2 = (avtDatabaseMetaDataObject *)obj;
    obj2->parent = parent;
}

void
PyavtDatabaseMetaData_SetDefaults(const avtDatabaseMetaData *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new avtDatabaseMetaData(*atts);
}

